using System;
using CustomItemLib;
using ItemStatsSystem;
using ReflectHelperLib.Helper;
using UnityEngine;

namespace AdvancedGraphicsCards
{
    /// <summary>
    /// 显卡配置数据
    /// </summary>
    [Serializable]
    public class GraphicsCardData : CustomItemData
    {
        public float Performance = 1.0f;
    }

    /// <summary>
    /// 显卡属性提供者
    /// </summary>
    public class GraphicsCardPropertyProvider : ICustomPropertyProvider
    {
        public void ApplyCustomProperties(Item item, CustomItemData data)
        {
            if (data is GraphicsCardData gpuData)
            {
                var performanceModifier = item.Modifiers.Find(m => m.Key == "Performance");
                if (performanceModifier != null)
                {
                    ReflectHelper.SetMemberValue(performanceModifier, "value", gpuData.Performance);
                }
            }
        }
    }
}